The listStyle property allows you to customize the behavior and appearance of a list in your UI when using the List view.
The listStyle property defines the visual style of a list, allowing you to choose from various predefined list styles.
The listStyle property accepts the following string values:
automatic: Uses the platform’s default behavior and appearance for a list.bordered: Displays a list with standard borders.carousel: Applies a carousel-like appearance to the list.elliptical: Gives the list an elliptical style.grouped: Displays the list in a grouped format.inset: Applies an inset appearance to the list.insetGroup: Combines inset and grouped styles for the list.plain: Displays the list in a plain style without additional decorations.sidebar: Renders the list in a sidebar-like appearance.If listStyle is not specified, the default style is determined by the platform.
Here’s how you can apply the listStyle property in your TypeScript code:
This creates a list with a plain style.
This creates a grouped list with sections.
This creates a sidebar-style list.
listStyle property directly maps to SwiftUI’s listStyle modifier.